﻿


-- 查询无卡的人员信息
CREATE procedure [dbo].[RyInfo_GetHaveNoCard]
@sfzh varchar(18) = null,
@xm varchar(10) =null
as
select Ry_Info.sfzh,xm,bzmc qybmm
from Ry_Info 
left join Bzry_Info on(Ry_Info.sfzh=Bzry_Info.sfzh)
left join Banz_Info on(Bzry_Info.bzid=Banz_Info.bzid)
where ygzt=1
and Ry_Info.sfzh not in (select RyCa_Info.sfzh from RyCa_Info where cxsj is null)
and (Ry_Info.sfzh like @sfzh+'%' or @sfzh is null) 
and (xm like '%'+@xm+'%' or @xm is null) 
order by createtime desc